<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>认识dom</title>
</head>

<body>
    
<!--             <h2>helloworld1</h2>
            <h2>helloworld2</h2>
            <h2 id="123">helloworld3</h2>
            <h2 class="456">helloworld4</h2>
            <h2 class="456">helloworld5</h2>
    <script type="text/javascript">

        //es5以前获取元素,标签名、id、class
        var a = document.getElementsByTagName('h2');
        console.log(a);
        var newArr = Array.from(a);
        console.log(newArr);
       
        
        var b = document.getElementById('123');
        console.log(b);



        var c = document.getElementsByClassName('456');
        console.log(c);
 -->
    <script type="text/javascript">
        var html = document.children[0];
        console.log(html);
        var body = html.children[1];
        console.log(body);
        body.innerHTML="<h1>hello!</h1></br><a href='http://baidu.com'>百度</a>";
    </script>
</body>

</html>